package com.example.houduan.Mapper;

import com.example.houduan.Pojo.Material;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface MaterialMapper {
    List<Material> selectMaterialLimit(int b, int e);
    
    List<Material> selectMaterialByConditions(Integer meterial_id, String title, String policy_title);

    @Select("select count(*) from material inner join medicalpolicy on material.medicalpolicy_id = medicalpolicy.medicalpolicy_id")
    int selectMaterialCount();
    
    @Delete("delete from material where meterial_id = #{meterial_id}")
    int deleteMaterial(int meterial_id);

    @Insert("insert into material values (#{meterial_id}, #{title}, #{message}, #{create_time}, #{update_time}, #{medicalPolicy.medicalpolicy_id})")
    int insertMaterial(Material material);

    @Update("update material set title = #{title}, message = #{message}, update_time = #{update_time}, medicalpolicy_id = #{medicalPolicy.medicalpolicy_id} where meterial_id = #{meterial_id}")
    int updateMaterial(Material material);
} 